package com.example.springdemo.design_model.decorator;

import lombok.extern.slf4j.Slf4j;

/**
 * 测试类
 * @author zhangding
 * @date 2022年6月26日19:03:19
 */
@Slf4j
public class DecoratorMain {
    public static void main(String[] args) {
        // 没有加调料的
        Beverage beverage = new Milk();
        log.info(beverage.getDescription() + "花费：" + beverage.cost());
        // 加了调料糖的,同样的，可以一直一层一层往下加
        Beverage beverage1 = new Milk();
        beverage1 = new Sugar(beverage1);
        // eg:beverage1 = new Salt(beverage1);
        log.info(beverage1.getDescription() + "花费：" + beverage1.cost());

    }
}
